package com.zaixiandiancan.xia.serviceImpl;

import com.zaixiandiancan.xia.dao.QrcodeDao;
import com.zaixiandiancan.xia.entity.Qrcode;
import com.zaixiandiancan.xia.service.QrcodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service(value = "goodsService")
public class QrcodeServiceImpl implements QrcodeService {
    @Autowired
    private QrcodeDao qrcodeDao;
    @Override
    public List<Qrcode> searchCode(Qrcode qrcode) {
        try {
            return qrcodeDao.searchCode(qrcode);
        }catch (Exception e){
            e.getStackTrace();
            return null;
        }
    }

    @Override
    @Transactional
    public boolean addCode(Qrcode qrcode) {
        try {
            return qrcodeDao.addCode(qrcode);
        }catch (Exception e){
            e.getStackTrace();
            System.out.println(e.getMessage());
            return false;
        }
    }

    @Override
    @Transactional
    public boolean deleteCode(Qrcode qrcode) {
        try {
            return qrcodeDao.deleteCode(qrcode);
        }catch (Exception e){
            e.getStackTrace();
            System.out.println(e.getMessage());
            return false;
        }
    }
}
